package src.entity;
import java.util.Date;

public class Goal {
    private String name;
    private String content;
    private int timeLimit; // 时限（天）
    private Date startDate;
    private int progress; // 进度（0-100）

    public Goal(String name, String content, int timeLimit, Date startDate) {
        this.name = name;
        this.content = content;
        this.timeLimit = timeLimit;
        this.startDate = startDate;
        this.progress = 0;
    }

    // 更新进度
    public void updateProgress(int delta) {
        this.progress = Math.min(100, Math.max(0, this.progress + delta));
    }

    // 判断是否完成
    public boolean isCompleted() {
        return progress >= 100;
    }

    // Getter & Setter
    public String getName() { return name; }
    public String getContent() { return content; }
    public int getTimeLimit() { return timeLimit; }
    public Date getStartDate() { return startDate; }
    public int getProgress() { return progress; }
}